package com.lookme.lmtool.cracker.filter.color;

import com.jhlabs.image.PosterizeFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_COLOR,name="色阶分离",filterClass = PosterizeFilter.class)
public class FilterPosterize extends AbstractFilter {
    @XStreamAsAttribute
    @ParamAnnotation(name = "色彩数量等级", desc = "色彩数量等级",inputType = ParamAnnotation.InputType.Slider,width = 300,min=1,max=256)
    int numLevels=127;

    @Override
    public BufferedImageOp getFilter() {
        PosterizeFilter filter= new PosterizeFilter();
        filter.setNumLevels(numLevels);
        return filter;
    }
}
